package com.command;

import java.util.ArrayList;
import java.util.Iterator;

import com.receiver.Receiver;

public class Command_failure implements Command {
	
	private ArrayList<Receiver> rec_list = new ArrayList<>();;
	
	public Command_failure(){
		super();
	}
	
	@Override
	public void add_receiver(Receiver receiver){
		rec_list.add(receiver);
	}
	
	@Override
	public void delete_receiver(Receiver receiver) {
		rec_list.remove(receiver);
	}
	
	@Override
	public void execute() {
		Iterator<Receiver> it = rec_list.iterator();
		while(it.hasNext()){
			it.next().destroy();
		}
	}
}
